home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat3 / librw / RWeistream.z / RWeistream
Encoding:
Text File  |  1998-10-30  |  21.9 KB  |  463 lines

  1.  
  2.  
  3.  
  4. RRRRWWWWeeeeiiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++))))                                              RRRRWWWWeeeeiiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++))))
  5.  
  6.  
  7.  
  8. NNNNaaaammmmeeee
  9.      RWeistream - Rogue Wave library class
  10.  
  11. SSSSyyyynnnnooooppppssssiiiissss
  12.               #include <rw/estream.h>
  13.  
  14.  
  15.  
  16.               RWeistream estr(cin);           // Construct an RWeistream,                                // using cin's streambuf
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24. DDDDeeeessssccccrrrriiiippppttttiiiioooonnnn
  25.      Class RRRRWWWWeeeeiiiissssttttrrrreeeeaaaammmm specializes the base class RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm to restore values
  26.      previously stored by RRRRWWWWeeeeoooossssttttrrrreeeeaaaammmm.  The endian streams, RRRRWWWWeeeeiiiissssttttrrrreeeeaaaammmm and
  27.      RRRRWWWWeeeeoooossssttttrrrreeeeaaaammmm, offer an efficient compromise between the portable streams
  28.      (RRRRWWWWppppiiiissssttttrrrreeeeaaaammmm, RRRRWWWWppppoooossssttttrrrreeeeaaaammmm) and the binary streams (RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm, RRRRWWWWbbbboooossssttttrrrreeeeaaaammmm).
  29.      By compensating for differences in big-endian vs. little-endian formats,
  30.      as well as sizes of the various integral types, the endian streams offer
  31.      portability without incurring the stream-size overhead of translating
  32.      values into a series of printable characters.  For example, data stored
  33.      in little-endian format by an RRRRWWWWeeeeoooossssttttrrrreeeeaaaammmm object in a DOS program can be
  34.      retrieved by an RRRRWWWWeeeeiiiissssttttrrrreeeeaaaammmm object on any of several machines, regardless
  35.      of its native endian format or the sizes of its integral types.  Endian
  36.      streams will work properly when shared among a group of platforms that:
  37.           Share a common size and representation (apart from endian format)
  38.           for types ffffllllooooaaaatttt and ddddoooouuuubbbblllleeee;
  39.  
  40.           Use two's complement format for negative integral values.
  41.  
  42.      As with the portable streams, care must be taken when storing or
  43.      retrieving variables of type char.  Endian stream methods treat chars as
  44.      numbers except where the method description explicitly states that the
  45.      char is being treated, instead, as a character.  See the entry for
  46.      RRRRWWWWppppoooossssttttrrrreeeeaaaammmm for an example of this distinction. Data stored in an integral
  47.      type on one platform may be too large to fit into that type on a
  48.      receiving platform. If so, the RRRRWWWWeeeeiiiissssttttrrrreeeeaaaammmm's failbit will be set.Endian
  49.      streams can be interrogated as to the stream state using member functions
  50.      ggggoooooooodddd(((()))), bbbbaaaadddd(((()))), eeeeooooffff(((()))), etc.
  51.  
  52. PPPPeeeerrrrssssiiiisssstttteeeennnncccceeee
  53.      None.
  54.  
  55. EEEExxxxaaaammmmpppplllleeee
  56.      See RRRRWWWWeeeeoooossssttttrrrreeeeaaaammmm for an example of how the file "ddddaaaattttaaaa....ddddaaaatttt" might be
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. RRRRWWWWeeeeiiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++))))                                              RRRRWWWWeeeeiiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++))))
  71.  
  72.  
  73.  
  74.      created.
  75.  
  76. PPPPuuuubbbblllliiiicccc CCCCoooonnnnssssttttrrrruuuuccccttttoooorrrrssss
  77.               RRRRWWWWeeeeiiiissssttttrrrreeeeaaaammmm(streambuf* s);
  78.  
  79.  
  80.      Construct an RRRRWWWWeeeeiiiissssttttrrrreeeeaaaammmm from the ssssttttrrrreeeeaaaammmmbbbbuuuuffff ssss.  For DOS, this ssssttttrrrreeeeaaaammmmbbbbuuuuffff
  81.      must have been created in binary mode.  Throw exception RRRRWWWWSSSSttttrrrreeeeaaaammmmEEEErrrrrrrr if
  82.      not a valid endian stream.
  83.  
  84.               RRRRWWWWeeeeiiiissssttttrrrreeeeaaaammmm(istream& str);
  85.  
  86.  
  87.      Construct an RRRRWWWWeeeeiiiissssttttrrrreeeeaaaammmm using the ssssttttrrrreeeeaaaammmmbbbbuuuuffff associated with the iiiissssttttrrrreeeeaaaammmm
  88.      ssssttttrrrr.  For DOS, the ssssttttrrrr must have been opened in binary mode.  Throw
  89.      exception RRRRWWWWSSSSttttrrrreeeeaaaammmmEEEErrrrrrrr if not a valid endian stream.
  90.  
  91. PPPPuuuubbbblllliiiicccc MMMMeeeemmmmbbbbeeeerrrr FFFFuuuunnnnccccttttiiiioooonnnnssss
  92.               virtual int
  93.           ggggeeeetttt();
  94.           virtual RWvistream&
  95.           ggggeeeetttt(char& c);
  96.           virtual RWvistream&
  97.           ggggeeeetttt(unsigned char& c);
  98.           virtual RWvistream&
  99.           ggggeeeetttt(char* v, size_t N);
  100.           virtual RWvistream&
  101.           ggggeeeetttt(unsigned char* v, size_t N);
  102.  
  103.  
  104.      Inherited from class RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm.
  105.  
  106.               virtual RWvistream&
  107.           ggggeeeetttt(wchar_t& wc);
  108.  
  109.  
  110.      Redefined from class RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm.  Get the next wwwwcccchhhhaaaarrrr____tttt from the input
  111.      stream and store it in wwwwcccc,,,, compensating for any differences in size or
  112.      endian format between the stream and the current environment.  Set the
  113.      failbit if the value in the stream is too large to be stored in wwwwcccc.
  114.  
  115.               virtual RWvistream&
  116.           ggggeeeetttt(wchar_t* v, size_t N);
  117.  
  118.  
  119.      Redefined from class RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm.  Get a vector of wwwwcccchhhhaaaarrrr____tttts and store it
  120.      in the array beginning at vvvv, compensating for any differences in size or
  121.      endian format between the stream and the current environment.  If the
  122.      restore stops prematurely, store whatever possible in vvvv, and set the
  123.      failbit.  Also set the failbit if any values in the stream are too large
  124.      to be stored in an element of vvvv.
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. RRRRWWWWeeeeiiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++))))                                              RRRRWWWWeeeeiiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++))))
  137.  
  138.  
  139.  
  140.               virtual RWvistream&
  141.           ggggeeeetttt(double* v, size_t N);
  142.  
  143.  
  144.      Redefined from class RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm.  Get a vector of ddddoooouuuubbbblllleeees and store them
  145.      in the array beginning at vvvv, compensating for any difference in endian
  146.      format between the stream and the current environment.  If the restore
  147.      stops prematurely, store whatever possible in vvvv, and set the failbit.
  148.  
  149.               virtual RWvistream&
  150.           ggggeeeetttt(float* v, size_t N);
  151.  
  152.  
  153.      Redefined from class RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm.  Get a vector of ffffllllooooaaaatttts and store them
  154.      in the array beginning at vvvv, compensating for any difference in endian
  155.      format between the stream and the current environment.  If the restore
  156.      stops prematurely, store whatever possible in vvvv, and set the failbit.
  157.  
  158.               virtual RWvistream&
  159.           ggggeeeetttt(int* v, size_t N);
  160.  
  161.  
  162.      Redefined from class RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm.  Get a vector of iiiinnnntttts and store them in
  163.      the array beginning at vvvv, compensating for any differences in size or
  164.      endian format between the stream and the current environment.  If the
  165.      restore stops prematurely, store whatever possible in vvvv, and set the
  166.      failbit.  Also set the failbit if any values in the stream are too large
  167.      to be stored in an element of vvvv.
  168.  
  169.               virtual RWvistream&
  170.           ggggeeeetttt(long* v, size_t N);
  171.  
  172.  
  173.      Redefined from class RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm.  Get a vector of lllloooonnnnggggs and store them in
  174.      the array beginning at vvvv, compensating for any differences in size or
  175.      endian format between the stream and the current environment.  If the
  176.      restore stops prematurely, store whatever possible in vvvv, and set the
  177.      failbit.  Also set the failbit if any values in the stream are too large
  178.      to be stored in an element of vvvv.
  179.  
  180.               virtual RWvistream&
  181.           ggggeeeetttt(short* v, size_t N);
  182.  
  183.  
  184.      Redefined from class RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm.  Get a vector of sssshhhhoooorrrrtttts and store them
  185.      in the array beginning at vvvv, compensating for any differences in size or
  186.      endian format between the stream and the current environment.  If the
  187.      restore stops prematurely, store whatever possible in vvvv, and set the
  188.      failbit.  Also set the failbit if any values in the stream are too large
  189.      to be stored in an element of vvvv.
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. RRRRWWWWeeeeiiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++))))                                              RRRRWWWWeeeeiiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++))))
  203.  
  204.  
  205.  
  206.               virtual RWvistream&
  207.           ggggeeeetttt(unsigned short* v, size_t N);
  208.  
  209.  
  210.      Redefined from class RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm.  Get a vector of uuuunnnnssssiiiiggggnnnneeeedddd sssshhhhoooorrrrtttts and
  211.      store them in the array beginning at vvvv.  If the restore stops
  212.      prematurely, store whatever possible in vvvv, and set the failbit.  Also set
  213.      the failbit if any values in the stream are too large to be stored in an
  214.      element of vvvv.
  215.  
  216.               virtual RWvistream&
  217.           ggggeeeetttt(unsigned int* v, size_t N);
  218.  
  219.  
  220.      Redefined from class RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm.  Get a vector of uuuunnnnssssiiiiggggnnnneeeedddd iiiinnnntttts and store
  221.      them in the array beginning at vvvv, compensating for any differences in
  222.      size or endian format between the stream and the current environment.  If
  223.      the restore stops prematurely, store whatever possible in vvvv, and set the
  224.      failbit.  Also set the failbit if any values in the stream are too large
  225.      to be stored in an element of vvvv.
  226.  
  227.               virtual RWvistream&
  228.           ggggeeeetttt(unsigned long* v, size_t N);
  229.  
  230.  
  231.      Redefined from class RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm.  Get a vector of uuuunnnnssssiiiiggggnnnneeeedddd lllloooonnnnggggs and
  232.      store them in the array beginning at vvvv, compensating for any differences
  233.      in size or endian format between the stream and the current environment
  234.      If the restore stops prematurely, store whatever possible in vvvv, and set
  235.      the failbit.  Also set the failbit if any values in the stream are too
  236.      large to be stored in an element of vvvv.
  237.  
  238.               virtual RWvistream&
  239.           ggggeeeettttSSSSttttrrrriiiinnnngggg(char* s, size_t N);
  240.  
  241.  
  242.      Redefined from class RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm.  Restores a character string from the
  243.      input stream and stores it in the array beginning at ssss.  The function
  244.      stops reading at the end of the string or after NNNN----1111 characters, whichever
  245.      comes first.  If the latter, then the failbit of the stream will be set,
  246.      and the remaining characters of the string will be extracted from the
  247.      stream and thrown away.  In either case, the string will be terminated
  248.      with a null byte.   If the size of the string is too large to be
  249.      represented by a variable of type ssssiiiizzzzeeee____tttt in the current environment, the
  250.      badbit of the stream will be set, and no characters will be extracted.
  251.      Note that the elements of the string are treated as characters, not
  252.      numbers.
  253.  
  254.               virtual RWvistream&
  255.           ooooppppeeeerrrraaaattttoooorrrr>>>>>>>>(char& c);
  256.  
  257.  
  258.  
  259.  
  260.  
  261.                                                                         PPPPaaaaggggeeee 4444
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. RRRRWWWWeeeeiiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++))))                                              RRRRWWWWeeeeiiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++))))
  269.  
  270.  
  271.  
  272.      Redefined from class RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm.  Get the next cccchhhhaaaarrrr from the input stream
  273.      and store it in cccc.  Note that cccc is treated as a character, not a number.
  274.  
  275.               virtual RWvistream&
  276.           ooooppppeeeerrrraaaattttoooorrrr>>>>>>>>(wchar_t& wc);
  277.  
  278.  
  279.      Redefined from class RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm.  Get the next wwwwcccchhhhaaaarrrr____tttt from the input
  280.      stream and store it in wwwwcccc,,,, compensating for any differences in size or
  281.      endian format between the stream and the current environment.  Set the
  282.      failbit if the value in the stream is too large to be stored in wwwwcccc.
  283.  
  284.               virtual RWvistream&
  285.           ooooppppeeeerrrraaaattttoooorrrr>>>>>>>>(double& d);
  286.  
  287.  
  288.      Redefined from class RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm.  Get the next ddddoooouuuubbbblllleeee from the input
  289.      stream and store it in dddd,,,, compensating for any difference in endian
  290.      format between the stream and the current environment.
  291.  
  292.               virtual RWvistream&
  293.           ooooppppeeeerrrraaaattttoooorrrr>>>>>>>>(float& f);
  294.  
  295.  
  296.      Redefined from class RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm.  Get the next ffffllllooooaaaatttt from the input
  297.      stream and store it in ffff,,,, compensating for any difference in endian
  298.      format between the stream and the current environment.
  299.  
  300.               virtual RWvistream&
  301.           ooooppppeeeerrrraaaattttoooorrrr>>>>>>>>(int& i);
  302.  
  303.  
  304.      Redefined from class RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm.  Get the next iiiinnnntttt from the input stream
  305.      and store it in iiii,,,, compensating for any differences in size or endian
  306.      format between the stream and the current environment.  Set the failbit
  307.      if the value in the stream is too large to be stored in iiii.
  308.  
  309.               virtual RWvistream&
  310.           ooooppppeeeerrrraaaattttoooorrrr>>>>>>>>(long& l);
  311.  
  312.  
  313.      Redefined from class RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm.  Get the next lllloooonnnngggg from the input stream
  314.      and store it in llll,,,, compensating for any differences in size or endian
  315.      format between the stream and the current environment.  Set the failbit
  316.      if the value in the stream is too large to be stored in llll.
  317.  
  318.               virtual RWvistream&
  319.           ooooppppeeeerrrraaaattttoooorrrr>>>>>>>>(short& s);
  320.  
  321.  
  322.      Redefined from class RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm.  Get the next sssshhhhoooorrrrtttt from the input
  323.      stream and store it in ssss,,,, compensating for any differences in size or
  324.  
  325.  
  326.  
  327.                                                                         PPPPaaaaggggeeee 5555
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334. RRRRWWWWeeeeiiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++))))                                              RRRRWWWWeeeeiiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++))))
  335.  
  336.  
  337.  
  338.      endian format between the stream and the current environment.  Set the
  339.      failbit if the value in the stream is too large to be stored in ssss.
  340.  
  341.               virtual RWvistream&
  342.           ooooppppeeeerrrraaaattttoooorrrr>>>>>>>>(unsigned char& c);
  343.  
  344.  
  345.      Redefined from class RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm.  Get the next uuuunnnnssssiiiiggggnnnneeeedddd cccchhhhaaaarrrr from the
  346.      input stream and store it in cccc.  Note that cccc is treated as a character,
  347.      not a number.
  348.  
  349.               virtual RWvistream&
  350.           ooooppppeeeerrrraaaattttoooorrrr>>>>>>>>(unsigned short& s);
  351.  
  352.  
  353.      Redefined from class RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm.  Get the next uuuunnnnssssiiiiggggnnnneeeedddd sssshhhhoooorrrrtttt from the
  354.      input stream and store it in ssss,,,, compensating for any differences in size
  355.      or endian format between the stream and the current environment.  Set the
  356.      failbit if the value in the stream is too large to be stored in ssss.
  357.  
  358.               virtual RWvistream&
  359.           ooooppppeeeerrrraaaattttoooorrrr>>>>>>>>(unsigned int& i);
  360.  
  361.  
  362.      Redefined from class RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm.  Get the next uuuunnnnssssiiiiggggnnnneeeedddd iiiinnnntttt from the
  363.      input stream and store it in iiii,,,, compensating for any differences in size
  364.      or endian format between the stream and the current environment.  Set the
  365.      failbit if the value in the stream is too large to be stored in iiii.
  366.  
  367.               virtual RWvistream&
  368.           ooooppppeeeerrrraaaattttoooorrrr>>>>>>>>(unsigned long& l);
  369.  
  370.  
  371.      Redefined from class RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm.  Get the next uuuunnnnssssiiiiggggnnnneeeedddd lllloooonnnngggg from the
  372.      input stream and store it in llll,,,, compensating for any differences in size
  373.      or endian format between the stream and the current environment.  Set the
  374.      failbit if the value in the stream is too large to be stored in llll.
  375.  
  376.               RRRRWWWWeeeeoooossssttttrrrreeeeaaaammmm::::::::EEEEnnnnddddiiiiaaaannnnssssttttrrrreeeeaaaammmmEEEEnnnnddddiiiiaaaannnn();
  377.  
  378.  
  379.      Return the endian format (RRRRWWWWeeeeoooossssttttrrrreeeeaaaammmm::::::::BBBBiiiiggggEEEEnnnnddddiiiiaaaannnn or
  380.      RRRRWWWWeeeeoooossssttttrrrreeeeaaaammmm::::::::LLLLiiiittttttttlllleeeeEEEEnnnnddddiiiiaaaannnn) of numeric values, as represented in the
  381.      stream.
  382.  
  383.               size_t
  384.           ssssttttrrrreeeeaaaammmmSSSSiiiizzzzeeeeooooffffIIIInnnntttt();
  385.  
  386.  
  387.      Return the size of iiiinnnntttts, as represented in the stream.
  388.  
  389.  
  390.  
  391.  
  392.  
  393.                                                                         PPPPaaaaggggeeee 6666
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400. RRRRWWWWeeeeiiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++))))                                              RRRRWWWWeeeeiiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++))))
  401.  
  402.  
  403.  
  404.               size_t
  405.           ssssttttrrrreeeeaaaammmmSSSSiiiizzzzeeeeooooffffLLLLoooonnnngggg();
  406.  
  407.  
  408.      Return the size of lllloooonnnnggggs, as represented in the stream.
  409.  
  410.               size_t
  411.           ssssttttrrrreeeeaaaammmmSSSSiiiizzzzeeeeooooffffSSSShhhhoooorrrrtttt();
  412.  
  413.  
  414.      Return the size of sssshhhhoooorrrrtttts, as represented in the stream.
  415.  
  416.               size_t
  417.           ssssttttrrrreeeeaaaammmmSSSSiiiizzzzeeeeooooffffSSSSiiiizzzzeeeeTTTT();
  418.  
  419.  
  420.      Return the size of ssssiiiizzzzeeee____tttts, as represented in the stream.
  421.  
  422.               size_t
  423.           ssssttttrrrreeeeaaaammmmSSSSiiiizzzzeeeeooooffffWWWWcccchhhhaaaarrrr();
  424.  
  425.  
  426.      Returns the size of wwwwcccchhhhaaaarrrr____tttts, as represented in the stream.
  427.  
  428.  
  429.  
  430.  
  431.  
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.                                                                         PPPPaaaaggggeeee 7777
  460.  
  461.  
  462.  
  463.